package com.iot08.admin.task;

import com.iot08.admin.service.PaymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author cwj
 * @description
 * @date 2025/2/26 11:02
 **/
@Slf4j
@Component
public class PaymentCompensationTask {

    @Resource
    private PaymentService paymentService;

    @Scheduled(cron = "0 0 23 * * ?")
    //@Scheduled(cron =  "0 */2 * * * *")
    public void updateApplePayOrderStatus() {
        try {
            log.info("开始执行苹果支付订单查询更新任务");
            //删除
            boolean result = paymentService.queryUpdateApplePayOrderInfo();
            if (result){
                log.info("苹果支付订单查询更新任务结束，成功执行");
            }else {
                log.error("苹果支付订单查询更新任务失败");
            }
        } catch (Exception ex) {
            log.error("苹果支付订单查询更新任务失败{}",ex.getMessage());
        }
    }
}
